home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / System 7.0 Samples / AEObject-Edition1.0.2 Sample / SampConstants.h < prev    next >
Encoding:
Text File  |  1994-11-18  |  7.5 KB  |  376 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2.  *
  3.  *  Apple Developer Technical Support
  4.  *
  5.  *  Constants
  6.  *
  7.  *  Program:    AEObject-Edition Sample
  8.  *  File:       SampConstants.h - C Source
  9.  *
  10.  *  by:         C.K. Haun <TR>
  11.  *
  12.  *  Copyright © 1990-1992 Apple Computer, Inc.
  13.  *  All rights reserved.
  14.  *
  15.  *------------------------------------------------------------------------------
  16.  * All the constants for this application 
  17.  *------------------------------------------------------------------------------*/
  18. /* •••• NOTE ••••  You will find NO (0) #defines for numbers in this file! */
  19. /* I have converted everything to 'enum's */
  20. /* Why?  One good reason.  You cannot redefine an enum, the compiler will */
  21. /* issue an error if you do.  Whereas #defines can be redefined  */
  22. /* constantly, and you will only see an error if you have -warnings full */
  23. /* turned on. */
  24. /* So enums are safer, you cannot accidentally redefine a constant and */
  25. /* have a nightmare of a time trying to figure out why your code doesn't work */
  26. /* They also are easier to work with for things like menu item numbers, if you add or delete */
  27. /* an item all you do is add or take out the name, the numbering is automatically updated*/
  28.  
  29. /* menu constants  */
  30. enum {kAppleMenu = 128,
  31.     kFileMenu,kEditMenu,
  32.     kToolsMenu,
  33.     kAEMenu,
  34.     kEditionMenu,
  35.     kWindowMenu,
  36.     kColorMenu};
  37. enum {kOurMenuBar = 148};
  38. enum {kNewItem = 1,
  39.     kOpenItem,
  40.     kCloseItem,
  41.     kSaveItem,
  42.     kSaveAsItem,
  43.     kBlankFile1,
  44.     kPrintItem,
  45.     kBlankFile2,
  46.     kPreferences,
  47.     kBlankFile3,
  48.     kQuitItem };
  49. /* edit menu constants */
  50. enum {kUndoItem = 1,
  51.     kBlankEdit1,
  52.     kCutItem,
  53.     kCopyItem,
  54.     kPasteItem,
  55.     kClearItem,
  56.     kBlankEdit2,
  57.     kPublishItem,
  58.     kSubscribeItem,
  59.     kSoptionsItem,
  60.     kBorders,
  61.     kBlankEdit3,
  62.     kClapNum};
  63. enum {kAboutItem = 1,
  64.     kAboutBox =  128};
  65. /* Tool menu constants */
  66. enum {kLineItem = 1,
  67.     kRectItem,
  68.     kOvalItem,
  69.     kTextBoxItem,
  70.     kSelectItem = 6};
  71. enum {kTopDown = 0x8000};
  72. /* AE menu constants */
  73. enum {kInteractionItem=1,
  74.     kAddressItem,
  75.     kReplyItem,
  76.     kBlankAE,
  77.     kShowAEWind,
  78.     kBlankAE2,
  79.     kWindowObjChar,
  80.     kTextObjectChar,
  81.     kShapeObjectChar,
  82.     kBlankAE3,
  83.     kSendGetDataAE,
  84.     kSendSetDataAE};
  85. /* GetData submenu items */
  86. enum {kGetDataSubmenu=1,
  87.     kSetDataSubmenu,
  88.     kNewElementSubmenu};
  89. /* these are the same for the get and set submenus */
  90. enum {kWindowBoundsItem=1,
  91.     kWindowTitleItem,
  92.     kWindowVisiblityItem,
  93.     kDataBlank1,
  94.     kAllText,
  95.     kWordText,
  96.     kDataBlank2,
  97.     kShapeItem
  98.     };
  99.     /*  */
  100.  
  101. /* this is for the new element submenu */
  102. enum {
  103.     kNewEWindowItem=1,
  104.     kNewEBlank1,
  105.     kNewETextItem,
  106.     kNewEWordItem,
  107.     kNewEBlank2
  108.     };
  109.  
  110. /* color menu */
  111. enum {kBlackColorItem=1,
  112.     kBlueColorItem,
  113.     kGreenColorItem,
  114.     kRedColorItem,
  115.     kYellowColorItem,
  116.     kCustomColorItem};
  117. /*  string resource */
  118. enum {kUndoStringsRes = 1001,
  119.     kClipBoardStrings,
  120.     kGeneralStrings};
  121. enum {kPrefsFileString = 1001,
  122.     kHelpString};
  123. /* general string constants */
  124. enum {kDotPub = 1,
  125.     kSavePromptString,
  126.     kPubOptString,
  127.     kSubOptString,
  128.     kShowBString,
  129.     kHideBString,
  130.     kSaveDotsString,
  131.     kSaveNDotsString,
  132.     kShowClipString,
  133.     kHideClipString,
  134.     kShowAEString,
  135.     kHideAEString,
  136.     kAESSavePrompt,
  137.     kAESDefaultName,
  138.     kTrueWord,
  139.     kFalseWord,
  140.     kSayRectangle,
  141.     kSettingVis,
  142.     kSettingBounds,
  143.     kSettingTitle,
  144.     kII,
  145.     kIII,
  146.     kIIII,
  147.     kIIIII,
  148.     kSettingShape,
  149.     kBringForward,
  150.     kErrorToSay,
  151.     kCPick,
  152.     kNewSCol,
  153.     kPPCPrompt1,
  154.     kPPCPrompt2,
  155.     kUCanxString,
  156.     kUnknownError
  157. };
  158. /* clipboard type content constants */
  159. enum { kClipUnused= 1,
  160.     kClipEmpty,
  161.     kClipHasPict,
  162.     kClipHasText,
  163.     kClipHasSub};
  164.  
  165.  
  166. /* alerts */
  167. enum {kNoMoreWindows =1000,
  168.     kDirtyAlert,
  169.     kNoSize,
  170.     kNoAppleEvents,
  171.     kNoEditionManager,
  172.     kCanxSub,
  173.     kBadMix};
  174. /* additional DITLs for publisher and subscriber boxes */
  175. enum{ kExpandedDITL= 2000,
  176. kExpandedSubDITL};
  177. enum {kNotInYet =134};
  178. enum {kSampHelp =300};
  179. enum {kEdInfo =133};
  180.  
  181. /*  dialogs */
  182. enum {kInteractionDialog = 301,
  183.     kAddressingDialog,
  184.     kReplyModeDialog};
  185. /* item numbers for these dialogs */
  186. enum {kSelfIItem=6,
  187.     kLocalIItem,
  188.     kAllIItem,
  189.     kNeverIItem,
  190.     kCanIItem,
  191.     kAlwaysIItem,
  192.     kSwitchLItem};
  193. enum {kSelfAddressCurrItem=4,
  194.     kSelfAddressPSNItem,
  195.     kOtherAppItem,
  196.     kOtherNameItem,
  197.     kSelectProcItem};
  198. enum {kNoReplyItem=4,
  199.     kWaitReplyItem,
  200.     kQueueReplyItem};
  201. enum {kSetWindowObject = 400,
  202.     kSetTextObject,
  203.     kSetShapeObject};
  204.  
  205.  
  206. /* item numbers for setData dialog  */
  207. enum {kSetDDialog =600};
  208. enum {kMakeVisItem=5,
  209.     kMakeInvisItem,
  210.     kRectTextItem,
  211.     kRectEdit1,
  212.     kRectEdit2,
  213.     kRectEdit3,
  214.     kRectEdit4,
  215.     kNewTitleWordsItem,
  216.     kNewTitleEditLineItem,
  217.     kNewTextItem,
  218.     kNewText,
  219.     kNewWordItem,
  220.     kNewTitleWordsItem2,
  221.     kNewTitleEditLineItem2,
  222.     kNewSBoundsRadio,
  223.     kNewSColorRadio,
  224.     kNewSColorButton        
  225.     
  226.     };
  227.  
  228.  
  229. enum {
  230. kWPosRadio = 5,
  231. kWTitleRadioSet,
  232. kWPosNum = 8,
  233. kWTitleELine
  234.  
  235. };
  236.  
  237.  
  238. enum {kBringAEForwardCheck=4,
  239.     kVerboseCheck,
  240.     kSaveWindCheck,
  241.     kSaveTextCheck,
  242.     kSaveShapeCheck,
  243.     kFred,
  244.     kSaveInteractCheck,
  245.     kSaveTargetCheck,
  246.     kSaveReplyCheck,
  247.     kFBox1,
  248.     kFBox2,
  249.     kFBox3};
  250. enum {kPreferencesBox = 800};
  251. /* window object  */
  252. enum {kWByIndex = 5,
  253.     kWByName,
  254.     kWIndexNum = 8,
  255.     kWIndexName};
  256. /* text */
  257. enum {kTextONumber = 5,
  258.     kWordIndex,
  259.     kWordIndexString=8};
  260. /* shape dialog */
  261. enum {
  262.     kLineRadio=3,
  263.     kRectangleRadio,
  264.     kOvalRadio,
  265.     kSByIndexRadio,
  266.     kSIEditLine = 8};
  267.  
  268. /* window templates */
  269. enum{ kClipWindow =128,
  270.     kAEStatusWindowID = 5000,
  271.     kDocWindow = 8888};
  272.  
  273. /* some general number constants */
  274. enum {kResumeMask = 1};        /* bit of message field for resume vs. suspend */
  275. enum  {kMinHeight =  150};    /* cannot shrink a window shorter than this */
  276. enum {kArrowArea =4};
  277. enum {kBorderArea = 7};
  278. enum {kMaxTextPreview = 200};
  279. enum {kWFormAbs = 5,
  280.     kWFormProp,
  281.     kWindowNumber = 8,
  282.     kWTitleRadio,
  283.     kWindowTitleText,
  284.     kWGray1,
  285.     kWGray2};
  286.  
  287. enum { kCurrentPrefsVersion = 0x101};
  288. enum {kVertScroll = 1,
  289.     kHorizScroll};
  290. enum {kMyTrue = -1};  /* all bits on */
  291. enum {kExpandedItem= 1};
  292. enum  {kGetSecInfo =2};
  293. enum {kNegFour = -4,
  294.     kFour=4};
  295. /* window kind numbers */
  296. enum {kDocumentWindow = 1000,
  297.     kClipboardWindow,
  298.     kAEStatusWindow};
  299. enum {kBadHInstall= 8080};
  300. enum {kMyAppNameString = 1000};
  301. enum {kMarchTime = 15};
  302. /* drawing action codes */
  303. enum{ kNoAction= 0,
  304.     kCantUndo= 0,
  305.     kDrawLine,
  306.     kDrawRect,
  307.     kDrawOval,
  308.     kTextBox,
  309.     kSelectStuff,
  310.     kMoveObject /*  <ckh 1.0.2>*/
  311.     };
  312. enum {kSavedOnce = 0x80};                                       /* for publisher saved info */
  313. enum {kNeverSaved =0};
  314. enum {kFakeKey = 555};    /* used in TextSections file */
  315. /* constants for text section checking */
  316. enum {kKeyStroke=0,
  317.     kAdding,
  318.     kRemoving};
  319. /* key codes */
  320. enum {
  321.     kEnterKey = 0x3,
  322.     kReturnKey = 0x0d,
  323.     kEscKey = 0x1B,
  324.     kLeftArrow,
  325.     kRightArrow,
  326.     kUpArrow,
  327.     kDownArrow,
  328.     kSpace};
  329. /* section types for my accounting */
  330. enum {kPictType =0,
  331.     kTextType,
  332.     kCustomType};
  333. enum {kSectionDirty = 0x80};  /* a bit flag */
  334. /* my error codes */
  335. #define     kErrorStringResourceType 'ERST'
  336. enum {kMySecNotFound = -80,
  337.     kWeirdSizeErr=-8666,
  338.     kTheErrorStrings = 128
  339.     };
  340. /* shape type defines */
  341. enum {kLineShape=0,
  342.     kRectShape,
  343.     kOvalShape,
  344.     kPictShape
  345.     };
  346.  
  347. enum {kSelfCur=0,
  348.     kSelfPSN,
  349.     kOtherApp};
  350. enum {kExtremeNeg = (-32768),kExtremePos = (32767 - 1)};
  351. enum {k64k= 65535};
  352. enum {kBaseMadFred = 134};
  353. /* two private resources type I use */
  354. #define rMyTextRecordType 'MTRT'
  355. #define rMyTextBlock 'MTBT'
  356.  
  357. #define kMySignature 'CKD1'
  358. #define kMyDocumentFileType 'FREd'
  359. #define kMyPrefsResType 'MPRF'
  360. #define kMyPrefsFileType 'PREF'
  361. #define kMPWSignature 'MPS '
  362. #define kGenericTEXTWord 'TEXT'
  363. #define kGenericPICTWord 'PICT'
  364. #define kRECTType 'RECT'
  365.  
  366.  
  367. /* My own constants for AE things */
  368. /* These of course can be anything you like, since they never leave  */
  369. /* your application */
  370. #define pAnyCharTextStyles 'acts'
  371. #define kAEMyShape 'MYSP'
  372.  
  373. /* my PString type  */
  374. #define typeMyPString 'MPST'
  375.  
  376.